/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * CompraTienda.java
 *
 * Created on 21/05/2011, 10:49:35 AM
 */
package GUI;

import Interfaz.InterfazControl;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;

/**
 *
 * @author Vane
 */
public class CompraTienda extends javax.swing.JFrame {

	/** Creates new form CompraTienda */
	public InterfazControl laInterfaz;

	public CompraTienda(InterfazControl laInterfaz) {
		this.laInterfaz = laInterfaz;
		initComponents();
		this.setLocationRelativeTo(null); // Cmabiar icono de java en ventana
		this.setIconImage(new ImageIcon("src/imagenes/marketplus2.png").getImage());
	}

	/** This method is called from within the constructor to
	 * initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is
	 * always regenerated by the Form Editor.
	 */
	@SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jToggleButtonCompraCarrito = new javax.swing.JToggleButton();
        jToggleButtonCompraScanner = new javax.swing.JToggleButton();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jBCatalogo = new javax.swing.JButton();
        jCSeleccionarSurcusarles = new javax.swing.JComboBox();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setMinimumSize(new java.awt.Dimension(500, 350));
        setResizable(false);
        getContentPane().setLayout(null);

        jToggleButtonCompraCarrito.setText("Comprar Con Carrito");
        jToggleButtonCompraCarrito.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jToggleButtonCompraCarritoActionPerformed(evt);
            }
        });
        getContentPane().add(jToggleButtonCompraCarrito);
        jToggleButtonCompraCarrito.setBounds(170, 100, 180, 23);

        jToggleButtonCompraScanner.setText("Compra Con Scanner");
        jToggleButtonCompraScanner.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jToggleButtonCompraScannerActionPerformed(evt);
            }
        });
        getContentPane().add(jToggleButtonCompraScanner);
        jToggleButtonCompraScanner.setBounds(170, 200, 180, 23);

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/carrito-imagen.jpg"))); // NOI18N
        jLabel2.setText("jLabel2");
        getContentPane().add(jLabel2);
        jLabel2.setBounds(370, 60, 100, 110);

        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/marketplus.png"))); // NOI18N
        getContentPane().add(jLabel3);
        jLabel3.setBounds(10, 0, 110, 80);

        jLabel5.setFont(new java.awt.Font("Tempus Sans ITC", 3, 18));
        jLabel5.setText(" Market Plus");
        getContentPane().add(jLabel5);
        jLabel5.setBounds(190, 40, 120, 30);

        jLabel4.setFont(new java.awt.Font("Tempus Sans ITC", 3, 14));
        jLabel4.setText("Sucursales");
        getContentPane().add(jLabel4);
        jLabel4.setBounds(20, 90, 90, 20);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/carrito_inteligente_thumb[2]_1.jpg"))); // NOI18N
        jLabel1.setText("jLabel1");
        getContentPane().add(jLabel1);
        jLabel1.setBounds(370, 180, 120, 90);

        jLabel6.setFont(new java.awt.Font("Tempus Sans ITC", 3, 18));
        jLabel6.setText("Supermercados");
        getContentPane().add(jLabel6);
        jLabel6.setBounds(180, 10, 150, 30);

        jLabel7.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel7.setText("RIF: J-122231245          Desarrollado por: Group Delivery");
        getContentPane().add(jLabel7);
        jLabel7.setBounds(110, 280, 320, 20);

        jBCatalogo.setText("Ir a Pág Principal");
        jBCatalogo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBCatalogoActionPerformed(evt);
            }
        });
        getContentPane().add(jBCatalogo);
        jBCatalogo.setBounds(10, 180, 150, 23);

        jCSeleccionarSurcusarles.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Seleccione Sucursal", "Los Caobos", "Prados del Este", "San Martín" }));
        getContentPane().add(jCSeleccionarSurcusarles);
        jCSeleccionarSurcusarles.setBounds(10, 120, 150, 20);

        pack();
    }// </editor-fold>//GEN-END:initComponents

	private void jToggleButtonCompraCarritoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButtonCompraCarritoActionPerformed
		// TODO add your handling code here:
	}//GEN-LAST:event_jToggleButtonCompraCarritoActionPerformed

	private void jToggleButtonCompraScannerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButtonCompraScannerActionPerformed
		// TODO add your handling code here:
		Integer indice = this.jCSeleccionarSurcusarles.getSelectedIndex();
		String sucursal="";
		if (indice == 0) {
			JOptionPane.showMessageDialog(null, "Error, debe escoger una Sucursal!");
		}
		else {
			if (indice == 1) {
				sucursal="Los Caobos";
				}
			if (indice==2){
				sucursal="Prados Del Este";
			}
			if (indice==3){
				sucursal="San Martín";
			}


				CompraScanner iraCompraScanner = new CompraScanner(laInterfaz,sucursal);
				iraCompraScanner.setVisible(true);
				this.dispose();
		}
	}//GEN-LAST:event_jToggleButtonCompraScannerActionPerformed

	private void jBCatalogoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBCatalogoActionPerformed
		// TODO add your handling code here:
		Principal iraPrincipal = new Principal(laInterfaz);
		iraPrincipal.setVisible(true);
		this.dispose();
}//GEN-LAST:event_jBCatalogoActionPerformed
	/**
	 * @param args the command line arguments
	 */
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jBCatalogo;
    private javax.swing.JComboBox jCSeleccionarSurcusarles;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JToggleButton jToggleButtonCompraCarrito;
    private javax.swing.JToggleButton jToggleButtonCompraScanner;
    // End of variables declaration//GEN-END:variables
}
